package com.hkd.common.api.convert;

import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * @author HKD
 * @date 2022/9/17 23:35
 */
@Component
public class LocalDateTimeConvert implements Converter<String, LocalDateTime> {
    @Override
    public LocalDateTime convert(String source) {

        return LocalDateTime.parse(source, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
    }
}
